/*
 * @(#)TransactionContext.java
 * Date 2014-01-12
 * Version 1.0
 * Author Jim Horner
 * Copyright (c)2012
 */


package us.hornerscorners.lamppost.ws;

import us.hornerscorners.lamppost.utils.UUIDUtils;


/**
 * Class description
 *
 *
 * @version        v1.0, 2014-01-12
 * @author         Jim Horner
 */
public class TransactionContext {

    /** Field description */
    private String transId;

    /**
     * Constructs ...
     *
     */
    public TransactionContext() {

        super();
        this.transId = UUIDUtils.generateURN();
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getTransId() {
        return transId;
    }

    /**
     * Class description
     *
     *
     * @version        v1.0, 2014-01-12
     * @author         Jim Horner
     */
    public static class Builder {

        /** Field description */
        private final TransactionContext context;

        /**
         * Constructs ...
         *
         */
        public Builder() {

            super();

            this.context = new TransactionContext();
        }

        /**
         * Method description
         *
         *
         * @return
         */
        public TransactionContext build() {

            return this.context;
        }

        /**
         * Method description
         *
         *
         * @param id
         *
         * @return
         */
        public TransactionContext transId(String id) {

            this.context.transId = id;

            return this.context;
        }
    }
}
